package com.ny.view;

import com.ny.entity.Product;
import com.ny.service.ProductService;
import com.ny.service.impl.ProductServiceImpl;

import java.sql.SQLException;
import java.util.Scanner;

public class DeleteProductForm {
    private ProductService ser = new ProductServiceImpl();

    public DeleteProductForm() throws SQLException, ClassNotFoundException {
    }

    public void showDeleteProForm() throws SQLException, ClassNotFoundException {
        System.out.println("请输入要删除的商品名：");
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        Product product = ser.deleteProduct(name);
        if (product == null) {
            System.out.println("删除成功");
        } else {
            System.out.println("删除失败");
        }
    }
}
